package com.lcifn.middleware.rpc.transport.future;

import com.lcifn.middleware.rpc.transport.command.Command;
import lombok.Data;

import java.util.concurrent.CompletableFuture;

/**
 * 响应Future
 * @author lichao
 * @date 2021/2/2 18:12
 */
@Data
public class ResponseFuture {
    // 请求id
    private final int requestId;
    // Future
    private final CompletableFuture<Command> future;
    // nano timestamp
    private final long timestamp;

    public ResponseFuture(int requestId, CompletableFuture<Command> future) {
        this.requestId = requestId;
        this.future = future;
        this.timestamp = System.nanoTime();
    }
}
